﻿/*----------------------------------------------------------------
    // Copyright (C) 2009 江苏华招网
    // 版权所有。 
    // 作者： 
    //
    // 文件名：HospitalMange.aspx.cs
    // 文件功能描述：医疗机构管理
    // 创建标识：吕海乐2009-05-25
    //
    // 修改标识：
    // 修改描述：
    //
    // 修改标识：
    // 修改描述：
    //
    // 审核人：
// 审核时间：
// 审核说明：
 //----------------------------------------------------------------*/
using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HZ.DrugTrade.BLLFactory;
using HZ.DrugTrade.IBLL;
using HZ.DrugTrade.Model;
using HZ.DrugTrade.Model.Enum;

namespace HZ.DrugTrade.Web.Admin.SystemManage
{
    public partial class DeleteHospital :BasePage
    {
        public DeleteHospital()
        {
            this.ModuleNo = Module.系统管理.ToString();
            this.PageOperateType = OperateType.医疗机构管理.ToString();
        }
        IBLL_Hospital ih = Factory.BLL_Hospital();
        IBLL_User iu = Factory.BLL_User();
        public static string Isshow = "none";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                labSource.Text = BindData();
            }
        }


        private string BindData()
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if (!string.IsNullOrEmpty(Request.QueryString["hID"]))
            {
                string hID = Request.QueryString["hID"];
                Model.HospitalInfo hospital = ih.GetHospitalInfoByID(hID);
                sb.Append("<table style=\"border:1px solid #ccc;\"><tr><td>医疗机构名称</td><td>注册号</td><td>地址</td><td>联系人</td><td>联系电话</td></tr>");
                sb.Append("<tr style='color:red'>");
                sb.Append("<td>" + hospital.HospitalName + "</td>");
                sb.Append("<td>" + hospital.HospitalID + "</td>");
                sb.Append("<td>" + hospital.Address + "</td>");
                sb.Append("<td>" + hospital.ContactPerson + "</td>");
                sb.Append("<td>" + hospital.CellNo + "</td>");
                sb.Append("</td></tr></table>");


                Isshow = "black";

            }
            else
            {
                sb.Append("<span style=\"color:red;font-size:12px\">医疗机构未找到</span>");//暂无数据
                Isshow = "none";
            }
            return sb.ToString();
               
        }
        /// <summary>
        /// 删除退货
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnReturn_Click(object sender, EventArgs e)
        {
            int i = ih.Delete_physicsHospital(Request.QueryString["hID"], "1");
            switch (i)
            {
                case 0:
                    HZ.Web.WebUtil.Alert("删除失败！", this);
                    break;
                case 1:
                    HZ.Web.WebUtil.Alert("删除成功", this);
                    break;
                case 2:
                    break;
            }
        }
       /// <summary>
       /// 删除结算发票
       /// </summary>
       /// <param name="sender"></param>
       /// <param name="e"></param>
        protected void btnInvoice_Click(object sender, EventArgs e)
        {
            int i = ih.Delete_physicsHospital(Request.QueryString["hID"], "2");
            switch (i)
            {
                case 0:
                    HZ.Web.WebUtil.Alert("删除失败！", this);
                    break;
                case 1:
                    HZ.Web.WebUtil.Alert("删除结算发票成功！", this);
                    break;
                case 2:
                    HZ.Web.WebUtil.Alert("请先删除退货！", this);
                    break;
            }
        }
        /// <summary>
        /// 删除采购单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnPurchase_Click(object sender, EventArgs e)
        {
            int i = ih.Delete_physicsHospital(Request.QueryString["hID"], "3");
            switch (i)
            {
                case 0:
                    HZ.Web.WebUtil.Alert("删除失败！", this);
                    break;
                case 1:
                    HZ.Web.WebUtil.Alert("删除采购单成功！", this);
                    break;
                case 2:
                    HZ.Web.WebUtil.Alert("请先删除结算单！", this);
                    break;
            }
        }
       /// <summary>
       /// 删除医疗机构采购目录
       /// </summary>
       /// <param name="sender"></param>
       /// <param name="e"></param>
        protected void btnDeleteProcurecatalog_Click(object sender, EventArgs e)
        {
            int i = ih.Delete_physicsHospital(Request.QueryString["hID"], "4");
            switch (i)
            {
                case 0:
                    HZ.Web.WebUtil.Alert("删除失败！", this);
                    break;
                case 1:
                    HZ.Web.WebUtil.Alert("删除成功！", this);
                    break;
                case 2:
                    PageError("请先删除采购单！", this.ReturnUrl);
                    break;
            }
        }
        /// <summary>
        /// 删除医疗机构
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDeleteHospitalID_Click(object sender, EventArgs e)
        {
            int i = ih.Delete_physicsHospital(Request.QueryString["hID"], "5");
            switch (i)
            {
                case 0:
                    HZ.Web.WebUtil.Alert("删除失败！", this);
                    break;
                case 1:
                    PageError("删除医疗机构成功！", this.ReturnUrl);
                    break;
                case 2:
                    PageError("请先删除医疗机构目录！", this.ReturnUrl);
                    break;
            }
        }

        


  
    }
}
